﻿<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    CodeFile="CreateUser.aspx.cs" Inherits="Admin_CreateUserName" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="titlePlaceHolder" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="menuPlaceHolder" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="contentPlaceHolder" runat="Server">
    <asp:UpdatePanel runat="server">
        <contenttemplate>
    <div style="width: 100%;">
        <table width="100%" style="padding-left: 7px;">
            <tr>
                <td class="inputlabel" style="width: 131px">
                    <%=Utilitys.Dictionary["UserName"]%>
                    : <span style="color: #ff0000">(<span>*</span>)</span></td>
                <td class="inputlabel">
                    <asp:TextBox ID="txtUserName" runat="server" Width="193px"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="NReq" ControlToValidate="txtUserName"
                        Display="None" ErrorMessage="<b>Tên đăng nhập</b><br />Không thể rỗng."></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="NReqE" TargetControlID="NReq"
                        HighlightCssClass="validatorCalloutHighlight" />
                </td>
            </tr>
            <tr>
                <td class="inputlabel" style="width: 131px; height: 26px;">
                    <%=Utilitys.Dictionary["FullName"]%>
                    : <span style="color: #ff0000">(<span>*</span>)</span></td>
                <td class="inputlabel" style="height: 26px">
                    <asp:TextBox ID="txtFullname" runat="server" Width="193px"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="fullname" ControlToValidate="txtFullname"
                        Display="None" ErrorMessage="<b>Tên đầy đủ</b><br />Không thể rỗng."></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="frfull" TargetControlID="fullname"
                        HighlightCssClass="validatorCalloutHighlight" />
                </td>
            </tr>
            <tr>
                <td class="inputlabel" style="width: 131px">
                    <%=Utilitys.Dictionary["Password"]%>
                    <span style="color: #ff0000">(<span>*</span>)</span>:</td>
                <td class="inputlabel">
                    <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Width="193px"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="pass" ControlToValidate="txtPassword"
                        Display="None" ErrorMessage="<b>Mật khẩu</b><br />Không thể rỗng."></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender1"
                        TargetControlID="pass" HighlightCssClass="validatorCalloutHighlight" />
                </td>
            </tr>
            <tr>
                <td class="inputlabel" style="width: 131px">
                    <%=Utilitys.Dictionary["Retpyepassword"]%>
                    <span style="color: #ff0000">(<span>*</span>)</span>:
                </td>
                <td class="inputlabel">
                    <asp:TextBox ID="txtRetypePassword" runat="server" TextMode="Password" Width="193px"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="rpass" ControlToValidate="txtRetypePassword"
                        Display="None" ErrorMessage="<b>Nhập lại mật khẩu</b><br />Không thể rỗng."></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender2"
                        TargetControlID="rpass" HighlightCssClass="validatorCalloutHighlight" />
                    <asp:CompareValidator Display="None" ControlToValidate="txtRetypePassword" ControlToCompare="txtPassword"
                        ID="cpass" runat="server" ErrorMessage="<b>So sánh hai mật khẩu</b><br /> Không hợp lệ"></asp:CompareValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender3"
                        TargetControlID="cpass" HighlightCssClass="validatorCalloutHighlight" />
                </td>
            </tr>
            <tr>
                <td style="height: 26px; width: 131px;" class="inputlabel">
                    <%=Utilitys.Dictionary["Email"]%>
                    <span style="color: #ff0000">(<span>*</span>)</span>:</td>
                <td style="height: 26px" class="inputlabel">
                    <asp:TextBox ID="txtEmail" runat="server" Width="194px"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="email" ControlToValidate="txtEmail"
                        Display="None" ErrorMessage="<b>Địa chỉ email</b><br />Không thể rỗng."></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender4"
                        TargetControlID="email" HighlightCssClass="validatorCalloutHighlight" />
                    <asp:RegularExpressionValidator Display="None" ID="erroremail" runat="server" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                        ControlToValidate="txtEmail" ErrorMessage="<b>Địa chỉ email</b><br />Không hợp lệ."></asp:RegularExpressionValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender5"
                        TargetControlID="erroremail" HighlightCssClass="validatorCalloutHighlight" />
                </td>
            </tr>
            <tr>
                <td class="inputlabel" style="width: 131px">
                    <%=Utilitys.Dictionary["Address"]%>
                    <span style="color: #ff0000">(<span>*</span>)</span>:</td>
                <td class="inputlabel">
                    <asp:TextBox ID="txtAddress" runat="server" Width="195px"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="address" ControlToValidate="txtAddress"
                        Display="None" ErrorMessage="<b>Địa chỉ</b><br />Không thể rỗng."></asp:RequiredFieldValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender6"
                        TargetControlID="address" HighlightCssClass="validatorCalloutHighlight" />
                </td>
            </tr>
            <tr>
                <td style="height: 26px; width: 131px;" class="inputlabel">
                    <%=Utilitys.Dictionary["Tel"]%>
                    :
                </td>
                <td style="height: 26px" class="inputlabel">
                    <asp:TextBox ID="txtTel" runat="server" Width="196px"></asp:TextBox>
                    <asp:RegularExpressionValidator Display="None" ID="phone" runat="server" ControlToValidate="txtTel"
                        ValidationExpression="^[0-9,.,#]+$" ErrorMessage="<b>Số điện thoại bàn</b><br />Chỉ là số."></asp:RegularExpressionValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender7"
                        TargetControlID="phone" HighlightCssClass="validatorCalloutHighlight" />
                </td>
            </tr>
            <tr>
                <td class="inputlabel" style="width: 131px">
                    <%=Utilitys.Dictionary["Cell"]%>
                    :
                </td>
                <td class="inputlabel">
                    <asp:TextBox ID="txtCell" runat="server" Width="196px"></asp:TextBox>
                    <asp:RegularExpressionValidator Display="None" ID="Cell" runat="server" ControlToValidate="txtCell"
                        ValidationExpression="^[0-9,.,#]+$" ErrorMessage="<b>Số điện thoại di động</b><br />Chỉ là số."></asp:RegularExpressionValidator>
                    <ajaxToolkit:ValidatorCalloutExtender runat="Server" ID="ValidatorCalloutExtender8"
                        TargetControlID="Cell" HighlightCssClass="validatorCalloutHighlight" />
                </td>
            </tr>
            <tr>
                <td class="inputlabel" style="width: 131px">
                    <%=Utilitys.Dictionary["Enable_"]%>
                    :</td>
                <td class="inputlabel">
                    <asp:CheckBox ID="ckbEnable" runat="server" /></td>
            </tr>
            <tr style="display: none">
                <td class="inputlabel" style="width: 131px">
                    <%-- <%=Utilitys.Dictionary["group_"]%>:--%>
                </td>
                <td class="inputlabel">
                    <asp:DropDownList runat="server" ID="ddlGroup" Width="200px" Visible="false">
                    </asp:DropDownList><asp:CustomValidator ID="cusDepartment" runat="server" ClientValidationFunction="ClientValidationDDl">*</asp:CustomValidator></td>
            </tr>
            <tr>
                <td class="inputlabel" style="width: 131px">
                    <%=Utilitys.Dictionary["Description"]%>
                    :
                </td>
                <td class="inputlabel">
                    <asp:TextBox ID="txtDescription" runat="server" Height="71px" MaxLength="200" TextMode="MultiLine"
                        Width="404px"></asp:TextBox></td>
            </tr>
            <tr>
                <td class="inputlabel" style="width: 131px">
                </td>
                <td class="inputlabel" colspan="2">
                    <asp:Button ID="btnsave" CssClass="bbutton" Text="Lưu lại" runat="server" OnClick="btnsave_Click" Width="116px" />&nbsp;&nbsp;
                    <asp:Button ID="btnexit" CssClass="bbutton" Text="Huỷ" runat="server" OnClick="btnexit_Click" CausesValidation="False"
                        Width="105px" /></td>
            </tr>
        </table>
        <br />
        <div class="display" style="padding-left: 14px;">
            <div class="control">
                <ul>
                    <li>
                        <asp:Label ID="lblerror" runat="server" ForeColor="#FF0033" Width="400px"></asp:Label></li><li>
                            <img alt="" src="images/ar1.gif" /><asp:LinkButton CssClass="blue" ID="lndelete"
                                OnClientClick="javascript: return confirm('Bạn có chắc là muốn xóa dòng này?');" runat="server" OnClick="lndelete_Click"
                                CausesValidation="false" Width="121px"><%=Utilitys.Dictionary["DeleteSelectedRows"]%></asp:LinkButton></li></ul>
            </div>
            <div class="view">
                <asp:Repeater ID="rptList" runat="server" OnItemCommand="rptList_ItemCommand" OnItemDataBound="rptList_ItemDataBound">
                    <ItemTemplate>
                        <tr valign="top">
                            <td nowrap style="text-align: center">
                                <asp:Literal ID="litNo" runat="server">1</asp:Literal><asp:HiddenField ID="hidID"
                                    runat="server" />
                            </td>
                            <td align="right">
                                <div align="left">
                                    <a href='CreateUser.aspx?id=<%# DataBinder.Eval(Container.DataItem, "UserID") %>'>
                                        <%# Server.HtmlEncode(Convert.ToString(DataBinder.Eval(Container.DataItem, "UserName")))%>
                                    </a>
                                </div>
                            </td>
                            <td align="right">
                                <div align="left">
                                    <asp:Label ID="lblFullname" runat="server">
                        <%# DataBinder.Eval(Container.DataItem, "Fullname")%>
                                    </asp:Label>
                                </div>
                            </td>
                            <td align="right">
                                <div align="left">
                                    <asp:Label ID="lblEmail" runat="server">
                         <%# DataBinder.Eval(Container.DataItem, "Email")%>
                                    </asp:Label>
                                </div>
                            </td>
                            <td align="right" width="200px;">
                                <div align="left">
                                    <asp:Label ID="lblAddress" runat="server">
                        <%# DataBinder.Eval(Container.DataItem, "Address")%>
                                    </asp:Label>
                                </div>
                            </td>
                            <td align="right">
                                <div align="left">
                                    <asp:Label ID="lblTel" runat="server">
                        <%# DataBinder.Eval(Container.DataItem, "Tel")%></asp:Label>
                                </div>
                            </td>
                            <td align="right" style="display: none;">
                                <div align="left">
                                    <asp:CheckBox ID="ckbEnable" runat="server" />
                                </div>
                            </td>
                            <td align="right" style="display: none;">
                                <div align="left">
                                    <asp:Label ID="lblDescription" runat="server">
                        <%# DataBinder.Eval(Container.DataItem, "Description")%></asp:Label>
                                </div>
                            </td>
                            <td style="text-align: center">
                                <asp:CheckBox runat="server" ID="ckbDelete" /></td>
                        </tr>
                    </ItemTemplate>
                    <HeaderTemplate>
                        <table cellspacing="1" cellpadding="3" width="100%" bgcolor="#cccccc" border="0">
                            <tr class="bluetitle">
                                <td align="center" width="1%" class="head">
                                    <%=Utilitys.Dictionary["OprNo"]%>
                                </td>
                                <td nowrap align="Left" width="*" class="head">
                                    <asp:LinkButton ID="LinkButton0" CausesValidation="false" runat="server" CommandArgument="ASC"
                                        CommandName="sortUserName"><%=Utilitys.Dictionary["UserName"]%></asp:LinkButton></td>
                                <td nowrap align="Left" width="*" class="head">
                                    <asp:LinkButton ID="LinkButton1" CausesValidation="false" runat="server" CommandArgument="ASC"
                                        CommandName="sortFullName"><%=Utilitys.Dictionary["FullName"]%></asp:LinkButton></td>
                                <td nowrap align="Left" width="*" class="head">
                                    <asp:LinkButton ID="LinkButton2" CausesValidation="false" runat="server" CommandArgument="ASC"
                                        CommandName="sortEmail"><%=Utilitys.Dictionary["Email"]%></asp:LinkButton></td>
                                <td nowrap align="Left" width="*" class="head">
                                    <asp:LinkButton ID="LinkButton3" CausesValidation="false" runat="server" CommandArgument="ASC"
                                        CommandName="sortAddress"><%=Utilitys.Dictionary["Address"]%></asp:LinkButton></td>
                                <td nowrap align="Left" width="*" class="head">
                                    <asp:LinkButton ID="LinkButton4" CausesValidation="false" runat="server" CommandArgument="ASC"
                                        CommandName="sortTel"><%=Utilitys.Dictionary["Tel"]%></asp:LinkButton></td>
                                <td nowrap align="Left" width="*" style="display: none;" class="head">
                                    <asp:LinkButton ID="LinkButton6" CausesValidation="false" runat="server" CommandArgument="ASC"
                                        CommandName="sortEnable"><%=Utilitys.Dictionary["Enable"]%></asp:LinkButton></td>
                                <td nowrap align="Left" width="*" style="display: none;" class="head">
                                    <asp:LinkButton ID="LinkButton7" CausesValidation="false" runat="server" CommandArgument="ASC"
                                        CommandName="sortDescription"><%=Utilitys.Dictionary["Description"]%></asp:LinkButton></td>
                                <td align="center" width="50" id="tdDelete" runat="server" class="head">
                                    <asp:CheckBox ID="checkall" onclick='CheckAll(this)' runat="server" /></td>
                            </tr>
                    </HeaderTemplate>
                    <FooterTemplate>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </div>
        </div>
        <div style="padding-top: 12px;" align="center">
            <PagerV2:PagerV2_8 ID="hyperlinkPager" runat="server" CompactModePageCount="5" GenerateFirstLastSection="true"
                OnCommand="pager_Command" GeneratePagerInfoSection="false" GenerateSmartShortCuts="false"
                GenerateHiddenHyperlinks="false" NormalModePageCount="5" />
        </div>
    </div>
     </contenttemplate>
    </asp:UpdatePanel>

    <script type="text/javascript">
       function CheckAll(obj)
        {
            // find any item not check
            var countUncheck = 0;
            var checkAll = true;
            var checkList = document.getElementsByTagName("input");
            if(!obj.checked)
            checkAll = false;
            for(var i = 0 ; i < checkList.length ; i++)
            { 
                if(checkList[i].type == 'checkbox' && checkList[i].id.indexOf("ckbDelete") >= 0 )
                {
                checkList[i].checked = checkAll;
                }
            } 
    }
        var j = document.getElementById("<%=btnsave.ClientID%>");
    j.value = "Lưu lại";
        var h = document.getElementById("<%=btnexit.ClientID%>");
    h.value = "Huỷ";
    </script>

</asp:Content>
